package LeetCode.leetcode27;

public class Review4 {
    public int removeElement(int[] nums, int val) {
        int slowIndex = 0, fastIndex = 0;
        while (fastIndex < nums.length){
            if (nums[fastIndex] == val){
                fastIndex++;
            }else {
                nums[slowIndex++] = nums[fastIndex++];
            }
        }
        return slowIndex;
    }
}
